package com.sunrise.xcrm.ui.main;

import javax.enterprise.event.Observes;

import org.vaadin.virkki.cdiutils.mvp.AbstractPresenter;
import org.vaadin.virkki.cdiutils.mvp.AbstractPresenter.ViewInterface;
import org.vaadin.virkki.cdiutils.mvp.CDIEvent;
import org.vaadin.virkki.cdiutils.mvp.ParameterDTO;

import com.sunrise.xcrm.ui.common.EventConstants;
import com.sunrise.xcrm.ui.detail.DetailView;

@SuppressWarnings("serial")
@ViewInterface(MainView.class)
public class MainPresenter extends AbstractPresenter<MainView> {

    protected final void changeContentView(@Observes @CDIEvent(EventConstants.ROW_EDIT) final ParameterDTO parameters) {
        // view.setContentView((CustomComponent) parameters.getPrimaryParameter());
        view.setContentView(new DetailView());
    }

    //
    // protected final void helpWindowRequested(@Observes @CDIEvent(HELP) final
    // ParameterDTO parameters) {
    // view.showHelpWindow();
    // }

    //
    // protected final void showAll(@Observes @CDIEvent(SHOW_ALL) final
    // ParameterDTO parameters) {
    // view.setView(ListView.class, true);
    // }
    //
    // protected final void newSearch(@Observes @CDIEvent(NEW_SEARCH) final
    // ParameterDTO parameters) {
    // view.setView(SearchView.class, true);
    // }
    //
    // protected final void newContact(@Observes @CDIEvent(NEW_CONTACT) final
    // ParameterDTO parameters) {
    // view.setView(ListView.class, true);
    // }
    //
    // protected final void saveSearch(@Observes @CDIEvent(SAVE_SEARCH) final
    // ParameterDTO parameters) {
    // SearchFilter searchFilter =
    // parameters.getPrimaryParameter(SearchFilter.class);
    // searchFilter = searchDAO.persist(searchFilter);
    // view.addSearchToTree(searchFilter);
    // }
    //
    // protected final void search(@Observes @CDIEvent(SEARCH) final
    // ParameterDTO parameters) {
    // view.setView(ListView.class, false);
    // }

    @Override
    protected final void initPresenter() {
        // NOP
    }

    @Override
    public final void viewOpened() {
        // NOP
    }

}
